<template>
	<view>
		<view class="list">
			<view class="item" v-for="(item,index) in list" :key="index" @click="clickto(item)">
				<image class="img" :src="imgurl+item.image" mode=""></image>
				<view class="right">
					<view class="title">
						{{item.title}}
					</view>
					<view class="time">
						{{item.createtime}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {getNoticeList} from '@/api/home.js'
	export default {
		data() {
			return {
				list: [],
				imgurl: ''
			};
		},
		onLoad() {
			this.imgurl = this.$BASE_URL
			getNoticeList().then(res=>{
				this.list=res.data.data
			})
		},
		methods: {
			getlist(){
				
			},
			clickto(item) {
				// 判断文章类型
				uni.navigateTo({
					url:'/pages/notice/info?id='+item.id
				})
			}
		},
		onPullDownRefresh() {
			this.getlist()
		},
		computed: {
			gettype() {
				return function(v, list) {
					let type = ''
					this.$store.state[list].map(t => {
						if (t.id == v) {
							type = t.name
						}
					})
					return type
				}
			},
		}
	}
</script>

<style lang="less">
	page {
		background-color: #F5F5F5;
	}

	.list {
		padding: 30rpx;

		.item {
			background-color: #fff;
			display: flex;
			align-items: center;
			margin-bottom: 20rpx;
			padding: 30rpx;
			border-radius: 20rpx;

			.img {
				width: 260rpx;
				height: 150rpx;
				border-radius: 10rpx;
				margin-right: 20rpx;

			}

			.right {
				height: 110rpx;
				padding: 20rpx 0;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				width: 350rpx;

				.title {

					font-size: 32rpx;
					font-weight: bold;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					-o-text-overflow: ellipsis;
				}

				.time {
					font-size: 24rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;

				}
			}
		}
	}
</style>
